layui.extend({
	userMock: "mock/user",
}).define(["userMock", "BaseServices", "apiUser", "utils"], function (exports) {
	var BaseServices = layui.BaseServices,
		userMock = layui.userMock,
		apiModule = layui.apiUser,
		utils = layui.utils;
	userMock();

	function UserServices(apiModule) {
		BaseServices.apply(this, arguments);
	}

	utils.inheritPrototype(UserServices, BaseServices);

	/**
	 * @author: ares
	 * @date: 2020/2/2 19:55
	 * @description: 获取当前登录用户信息
	 */
	UserServices.prototype.getCurrentUserInfo = function () {
		return this.service(this.apiModule.api.getCurrentUserInfo);
	}

	/**
	 * @author: ares
	 * @date: 2021/4/28 11:23
	 * @description: 启用|禁用用户
	 * @param {string}userId   用户id
	 * @param {boolean}disabled 时候禁用
	 */
	UserServices.prototype.disable = function (userId, disabled) {
		var params = {
			userId: userId,
			disabled: disabled
		};
		return this.service(this.apiModule.api.disable, {method: 'put', params: params});
	}

	/**
	 * @author: ares
	 * @date: 2021/4/28 11:24
	 * @description: 重置用户密码
	 * @param {string}userId   用户id
	 */
	UserServices.prototype.resetPwd = function (userId) {
		var params = {
			userId: userId,
		};
		return this.service(this.apiModule.api.resetPwd, {method: 'put', params: params});
	}
	exports("userServices", new UserServices(apiModule));
});
